<template>
  <div class="top">
    <div class="left">
        <span class="lbtn" @click="$router.push('/home')">首页</span>
    </div>
    <div class="center">
        <div class="title">智慧旅游可视化大数据平台</div>
    </div>
    <div class="right">
        <span class="rbtn">统计报告</span>
        <span class="time">当前时间：{{ time }}</span>
    </div>
    
  </div>
</template>

<script setup>
import moment from 'moment';
import { ref,onMounted,onBeforeUnmount } from 'vue';
const times =ref(0)
const time = ref(moment().format('YYYY年MM月DD日 hh:mm:ss'));
//组件挂载完毕更新当前的事件
onMounted(() => {
   times.value = setInterval(() => {
       time.value = moment().format('YYYY年MM月DD日 hh:mm:ss');
   }, 1000);
});
// 组件销毁时清除定时器
onBeforeUnmount(() => {
    clearInterval(times.value);
})
</script>

<style scoped lang="less">
.top {
    width: 100%;
    height: 40px;
    display: flex;
    .left {
        flex: 1.5;
        background: url("../../images/dataScreen-header-left-bg.png") no-repeat;
        background-size: cover;
        .lbtn {
            width: 150px;
            height: 40px;
            color: #29fcff;
            float: right;
            background-image: url("../../images/dataScreen-header-btn-bg-l.png");
            background-size: 100% 100%;
            font-size: 22px;
            text-align: center;
        }
    }
    .center {
        flex: 2;
        .title {
            width: 100%;
            height: 75px;
            background: url(../../images/dataScreen-header-center-bg.png) no-repeat;
            background-size: 100% 100%;
            text-align: center;
            line-height: 75px;
            color: #29fcff;
            font-size: 32px;
        }
    }
    .right {
        flex: 1.5;
        background: url(../../images/dataScreen-header-left-bg.png) no-repeat;
        background-size: cover;
        display: flex;
        justify-content: space-between;
        align-items: center;
        .rbtn {
            width: 150px;
            height: 40px;
            background: url(../../images/dataScreen-header-btn-bg-r.png) no-repeat;
            background-size: 100% 100%;
            text-align: center;
            line-height: 40px;
            font-size: 22px;
            color: #29fcff;
        }

        .time {
            color: #29fcff;
            font-size: 22px;
            margin-right: 10px;
        }
    }
}




</style>